import { createApp, createVNode } from 'vue'
import App from './App.vue'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import '@/styles/index.scss'
// svg 插件需要的配置代码
import 'virtual:svg-icons-register'
// import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
// 引入vue-router核心插件并安装
import router from '@/router/index.ts'
// 引入pinia 仓库
import pinia from '@/store'
//引入自定义插件对象:注册整个项目全局组件
import gloalComponent from '@/components'
import gloalDirectives from '@/directives'
//暗黑模式需要的样式
import 'element-plus/theme-chalk/dark/css-vars.css'
import '@/styles/element/index.scss'
import { zhCn } from 'element-plus/es/locales.mjs'
import * as Icons from '@element-plus/icons-vue'
// 引入例子特效
import VueParticles from 'vue3-particles'
const app = createApp(App)
app.use(gloalComponent)
app.use(gloalDirectives)
app.use(ElementPlus, {
     locale: zhCn, // 引入element-plus国际化
})
const Icon = (props: { icon: string }) => {
     const { icon } = props
     return createVNode(Icons[icon as keyof typeof Icons])
}

/* 
引入mars3d *************************
*/
//引入cesium基础库
import 'mars3d-cesium/Build/Cesium/Widgets/widgets.css'
import * as Cesium from 'mars3d-cesium'
//导入mars3d主库
import 'mars3d/mars3d.css' //v3.8.6及之前版本使用 import "mars3d/dist/mars3d.css";
import * as mars3d from 'mars3d'
//导入mars3d插件（按需使用，需要先npm install）
import 'mars3d-space'
declare global {
     interface Window {
          Cesium: typeof Cesium
          mars3d: typeof mars3d
     }
}
//设置cesium全局对象
window.Cesium = Cesium
window.mars3d = mars3d
/*
 *****************************************************
 */

// 引入epic-designer样式
import 'epic-designer/dist/style.css'

// 引入Element plus样式
import 'element-plus/dist/index.css'

import { setupElementPlus } from 'epic-designer/dist/ui/elementPlus'
// 注册Element UI
setupElementPlus()

//引入路由鉴权文件
import './permission'

app.component('Icon', Icon)
app.use(router)
app.use(pinia)
app.use(VueParticles)
app.mount('#app')
// 引入自定义指令
